#pragma once
#include "Constant.h"
#include "TimeSys.h"
#include "CoordSys.h"
#include "ReadN.h"
#include "ReadO.h"
#include "GNSSSatPos.h"
#include "IonoCorr.h"
#include "TropCorr.h"
#include <vector>

using namespace std;
class SPP {
public:
    SPP(GNSSconsts* gnssConsts, TimeSys* timeSys, CoordSys* coordSys, ReadN* readN, ReadO* readO);
    XYZ calculate_ReceiverPosition();

private:
    GNSSconsts* mGnssConsts;
    TimeSys* mTimeSys;
    CoordSys* mCoordSys;
    ReadN* mReadN;
    ReadO* mReadO;
    GNSSSatPos* mSatPos;
    IonoCorr* mIonoCorr;
    TropCorr* mTropCorr;

    vector<XYZ> get_SatPositions(const obsEpoch& epoch, BaseT obsTime);
    vector<double> get_Pseudoranges(const obsEpoch& epoch, const vector<XYZ>& satPositions, const XYZ& recPos, SOW sow);
    void leastSquares(const vector<XYZ>& satPositions, const vector<double>& pseudoranges, XYZ& recPos, double& dt);
};